﻿using System;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations.Schema;
using YiSha.Util;
using System.Collections.Generic;

namespace YiSha.Entity.QixingManage
{
    /// <summary>
    /// 创 建：admin
    /// 日 期：2023-03-19 19:40
    /// 描 述：商品信息表实体类
    /// </summary>
    [Table("goods_info")]
    public class GoodsEntity : BaseEntity
    {
        /// <summary>
        /// 商品编码
        /// </summary>
        /// <returns></returns>
        public string goods_core { get; set; }
        /// <summary>
        /// 商品名称
        /// </summary>
        /// <returns></returns>
        public string goods_name { get; set; }
        /// <summary>
        /// 是否主推荐商品：0.非推荐1.推荐
        /// </summary>
        /// <returns></returns>
        public int is_master { get; set; }
        /// <summary>
        /// 国条码
        /// </summary>
        /// <returns></returns>
        public string bar_code { get; set; }
        /// <summary>
        /// 品牌表的ID
        /// </summary>
        /// <returns></returns>
        [JsonConverter(typeof(StringJsonConverter))]
        public long? brand_id { get; set; }

        [NotMapped]
        public string brand_name { get; set; }
        /// <summary>
        /// 一级分类ID
        /// </summary>
        /// <returns></returns>
        [JsonConverter(typeof(StringJsonConverter))]
        public long? category_id { get; set; }

        /// <summary>
        /// 分类名称
        /// </summary>
        public string category_name { get; set; }
        /// <summary>
        /// 商品的供应商ID
        /// </summary>
        /// <returns></returns>
        [JsonConverter(typeof(StringJsonConverter))]
        public long? shop_id { get; set; }
        /// <summary>
        /// 商品销售价格
        /// </summary>
        /// <returns></returns>
        public float? price { get; set; }
        /// <summary>
        /// 上下架状态：0下架1上架
        /// </summary>
        /// <returns></returns>
        public int? publish_status { get; set; }
        /// <summary>
        /// 审核状态：0未审核，1已审核
        /// </summary>
        /// <returns></returns>
        public int audit_status { get; set; }
        /// <summary>
        /// 商品重量
        /// </summary>
        /// <returns></returns>
        public double weight { get; set; }
        /// <summary>
        /// 商品长度
        /// </summary>
        /// <returns></returns>
        public double length { get; set; }
        /// <summary>
        /// 商品高度
        /// </summary>
        /// <returns></returns>
        public double height { get; set; }
        /// <summary>
        /// 商品宽度
        /// </summary>
        /// <returns></returns>
        public double width { get; set; }
        /// <summary>
        /// 生产日期
        /// </summary>
        /// <returns></returns>
        [JsonConverter(typeof(DateTimeJsonConverter))]
        public DateTime? production_date { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        /// <returns></returns>
        public string description { get; set; }
        /// <summary>
        /// 录入时间
        /// </summary>
        /// <returns></returns>
        [JsonConverter(typeof(DateTimeJsonConverter))]
        public DateTime? indatetime { get; set; }
        /// <summary>
        /// 最后更新时间
        /// </summary>
        /// <returns></returns>
        [JsonConverter(typeof(DateTimeJsonConverter))]
        public DateTime? modified_time { get; set; }
        /// <summary>
        /// 商品类别；1租车2新车3二手车
        /// </summary>
        /// <returns></returns>
        [JsonConverter(typeof(StringJsonConverter))]
        public long? goods_type { get; set; }
        /// <summary>
        /// 购买次数
        /// </summary>
        /// <returns></returns>
        public int? goods_buyCount { get; set; }
        /// <summary>
        /// 商品详情
        /// </summary>
        /// <returns></returns>
        public string goods_intro { get; set; }
        /// <summary>
        /// 商品简介
        /// </summary>
        /// <returns></returns>
        public string goods_brief { get; set; }
        /// <summary>
        /// 商品缩略图
        /// </summary>
        /// <returns></returns>
        public string goods_image { get; set; }
        /// <summary>
        /// 商品图集
        /// </summary>
        /// <returns></returns>
        public string goods_images { get; set; }
        /// <summary>
        /// 商品型号
        /// </summary>
        /// <returns></returns>
        public string goods_model { get; set; }
        /// <summary>
        /// 商品型号ID
        /// </summary>
        [JsonConverter(typeof(StringJsonConverter))]
        public long? goods_model_id { get; set; }
        /// <summary>
        /// 单位(1件)
        /// </summary>
        /// <returns></returns>
        public string unit { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        /// <returns></returns>
        public int? sort { get; set; }
        /// <summary>
        /// 当前商品数量
        /// </summary>
        /// <returns></returns>
        public int? current_cnt { get; set; }

        public string shop_name { get; set; }

        [JsonConverter(typeof(StringJsonConverter))]
        public long? tenant_id { get; set; }

        public string goods_attr { get; set; }

        public float? car_rental_price { get; set; }

        public int source { get; set; }

        [JsonConverter(typeof(StringJsonConverter))]
        public long? Type { get; set; }

        public string goods_images_ext { get; set; }

        public string modellist { get; set; }

        /// <summary>
        /// 折扣价格
        /// </summary>
        public decimal discount{ get; set; }
    }


    public class GoodsFormDto
    {
        [JsonConverter(typeof(StringJsonConverter))]
        public long? Id { get; set; }

        [JsonConverter(typeof(StringJsonConverter))]
        public long? shop_id { get; set; }

        [JsonConverter(typeof(StringJsonConverter))]
        public long? brand_id { get; set; }

        public string shop_name { get; set; }

        [JsonConverter(typeof(StringJsonConverter))]
        public long? tenant_id { get; set; }

        /// <summary>
        /// 一级分类ID
        /// </summary>
        /// <returns></returns>
        [JsonConverter(typeof(StringJsonConverter))]
        public long? category_id { get; set; }

        /// <summary>
        /// 分类名称
        /// </summary>
        public string category_name { get; set; }

        /// <summary>
        /// 商品详情
        /// </summary>
        /// <returns></returns>
        public string goods_intro { get; set; }
        /// <summary>
        /// 商品简介
        /// </summary>
        /// <returns></returns>
        public string goods_brief { get; set; }
        /// <summary>
        /// 商品缩略图
        /// </summary>
        /// <returns></returns>
        public string goods_image { get; set; }
        /// <summary>
        /// 商品图集
        /// </summary>
        /// <returns></returns>
        public string goods_images { get; set; }

        /// <summary>
        /// 商品类别；1租车2新车3二手车
        /// </summary>
        /// <returns></returns>
        [JsonConverter(typeof(StringJsonConverter))]
        public long? goods_type { get; set; }

        [JsonConverter(typeof(StringJsonConverter))]
        public long? Type { get; set; }

        /// <summary>
        /// 商品销售价格
        /// </summary>
        /// <returns></returns>
        public float? price { get; set; }

        /// <summary>
        /// 商品编码
        /// </summary>
        /// <returns></returns>
        public string goods_core { get; set; }
        /// <summary>
        /// 商品名称
        /// </summary>
        /// <returns></returns>
        public string goods_name { get; set; }
        /// <summary>
        /// 是否主推荐商品：0.非推荐1.推荐
        /// </summary>
        /// <returns></returns>
        public int is_master { get; set; }

        /// <summary>
        /// 参送
        /// </summary>
        public string BaseGoodsAttrList { get; set; }

        /// <summary>
        /// 出租价格
        /// </summary>
        public float? car_rental_price { get; set; }

        /// <summary>
        /// 规格颜色
        /// </summary>
        public List<GoodsGG> GetList { get; set; } = new List<GoodsGG>();

        public List<GoodsSkuStockEntity> goodsSkus { get; set; } = new List<GoodsSkuStockEntity>();

        public List<ColorsEntity>  colorsEntities { get; set; } = new List<ColorsEntity>();
        
        public string goods_images_ext { get; set; }

        public string input_models { get; set; }

        public string unit { get; set; }

        public decimal discount { get; set; }

        /// <summary>
        /// 会员比例
        /// </summary>
        public List<GoodsMemberGradeEntity> MemberGrade { get; set; } = new List<GoodsMemberGradeEntity>();
    }

    public class GoodsGG
    {
        [JsonConverter(typeof(StringJsonConverter))]
        public long? Id { get; set; }
        public string color { get; set; }
        public string image { get; set; }
        public int num { get; set; }
        public decimal? price { get; set; }
        public int? isDefault { get; set; }
    }
}
